package com.csproj.system.repository.impl;


import com.csproj.system.domain.RoleInfo;
import com.csproj.system.repository.custom.RoleInfoRepositoryCustom;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.util.Map;

public class RoleInfoRepositoryImpl implements RoleInfoRepositoryCustom {

    @PersistenceContext
    private EntityManager em;

    public EntityManager getEm() {
        return em;
    }

    /**
     * 权限信息 分页查询方法
     * @param hsql          sql语句
     * @param queryParams   参数
     * @param pageable      分页对象
     * @return
     */
    public Page<RoleInfo> findPageList(String hsql, Map<String, Object> queryParams, Pageable pageable) {
        //拼hql
        String hql =  " from RoleInfo r where deletedFlag = 0 " + hsql;
        //查询
        Page<RoleInfo> fieldList = query(hql,pageable,queryParams);
        //返回
        return fieldList;
    }

}
